package org.zjx.analyse.action;

import org.zjx.analyse.AbstractAction;
import org.zjx.analyse.IWindowAction;
import org.zjx.analyse.ScreenshotAnalyse;
import org.zjx.resolution.IScreenResolution;
import org.zjx.util.HwndUtil;

import java.awt.event.KeyEvent;

public class LoginWindowAction extends AbstractAction implements IWindowAction {

    public LoginWindowAction(IScreenResolution screenResolution, ScreenshotAnalyse screenshotAnalyse) {
        super(screenResolution,screenshotAnalyse);
    }

    @Override
    public boolean isOpened() {
        return HwndUtil.haveHwnd(gameWindow.getHwnd());
    }

    @Override
    public void open() {
        gameWindow.flush();
    }

    @Override
    public void close() {
        gameWindow.pressKeyCombination(KeyEvent.VK_ALT, KeyEvent.VK_F4);
    }

    @Override
    public void reSetWindow() {
        gameWindow.moveMouse(gameWindow.getInitPoint().x, gameWindow.getInitPoint().y);
    }
}
